//
//  PageCollectionViewCell.swift
//  AFNetworking
//
//  Created by admin on 2020/4/26.
//

import UIKit
import SnapKit

class PageCollectionViewCell: UICollectionViewCell {
    
    lazy var titleLab :UILabel = {
        () -> UILabel in
        let titleLab = UILabel()
        titleLab.textAlignment = .center
        titleLab.font = FONT_SYS12
        
        return titleLab
    }()
    lazy var remarkView :UIView = {
        () -> UIView in
        let remarkView = UIView()
        return remarkView
    }()
    
 
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        configUI()
    }
    
    override var isSelected: Bool {
        didSet {
            if isSelected {
                titleLab.font = FONT_SYS14
                titleLab.textColor = COLORDANGER
                remarkView.backgroundColor = COLORDANGER
            }else{
                titleLab.font = FONT_SYS12
                titleLab.textColor = COLORINFO
                remarkView.backgroundColor = .clear
            }
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func configUI(){
        addSubview(titleLab)
        addSubview(remarkView)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        titleLab.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
        remarkView.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview()
            make.width.equalToSuperview().dividedBy(2)
            make.centerX.equalToSuperview()
            make.height.equalTo(2)
        }
    }
}
